﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ICeFramework.Win.UI
{
    public class LabelGrid : TableLayoutPanel
    {
        private Dictionary<string, string> _labels = new Dictionary<string, string>();

        public LabelGrid()
            : base()
        {
            //this.ColumnStyles[1].SizeType = SizeType.
        }

        public void AddLabel(string caption, string value, ICLabelType labelType)
        {
            AddLabel(caption, value, labelType, 0, 0);
        }

        public void AddLabel(string caption, string value, ICLabelType labelType, int valueLeft, int valueWidth)
        {
            _labels.Add(caption, value);
            ICLabel lbl = new ICLabel();

            lbl.Caption = caption.Trim();
            lbl.Value = value.Trim();

            lbl.AutoAlign = valueLeft <= 0;
            lbl.ValueLeft = valueLeft;
            lbl.ValueWidth = valueWidth;

            if (labelType == ICLabelType.Multiline)
            {
                lbl.LabelType = labelType;
            }

            this.Controls.Add(lbl);
        }
        
    }
}
